﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;

namespace Utility
{
    public static class RegistoryManager
    {
        public static string GetLocalMachineValue(string key,string name)
        {
            if (string.IsNullOrWhiteSpace(key))
                throw new ArgumentNullException();
            if (string.IsNullOrWhiteSpace(name))
                throw new ArgumentNullException();

            RegistryKey regKey = Registry.LocalMachine.OpenSubKey(key);
            if (regKey == null)
                return null;
            object regValue = regKey.GetValue(name);
            if (regValue == null)
                return null;

            return regValue.ToString();
        }
    }
}
